﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _2._2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

       

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                textBox3.Text = "";
                int a = int.Parse(textBox1.Text);
                int b = int.Parse(textBox2.Text);
                bool nums;
                if (b < a)
                {
                    int item = a;
                    a = b;
                    b = item;
                };
                if (a < 2) { a = 2; }
                for (int j = a; j < b; j++)
                {
                    nums = true;
                    for (int i = 2; i < j; i++)
                    {
                        if (j % i == 0)
                        {
                            nums = false;
                            break;
                        }
                    }
                    if (nums == true) {
                        textBox3.Text = textBox3.Text + j + " ";
                    }
                }
            }
            catch (Exception)
            {
                textBox3.Text=("请在两个输入框内都输入整数");
                return;
            }
        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
